#include "trap.h"
#include "instr_def.h"
#include "instr_test.h"
    .set noreorder
    .set noat
    .globl main
    .text
main:
    li $k1, 0x1
    # BREAK 1
    addi $k0, $zero, 0x1111 
    break # TEST ERROR
    nop
    bne $k0, $zero, res_error
    nop
    sub $k0, $k1, $k0
    break
    bne $k0, $zero, res_error
    nop
    slt $k0, $k1, $k0
    break
    bne $k0, $zero, res_error
    nop
    slti $k0, $k0, 0x0011
    break
    bne $k0, $zero, res_error
    nop
    andi $k0, $k1, 0x1
    break
    bne $k0, $zero, res_error
    break

    # SYSCALL 2
    addi $k0, $zero, 0x1111 
    syscall
    bne $k0, $zero, res_error
    nop
    sub $k0, $k1, $k0
    syscall
    bne $k0, $zero, res_error
    nop
    slt $k0, $k1, $k0
    syscall
    bne $k0, $zero, res_error
    nop
    slti $k0, $k0, 0x0011
    syscall
    bne $k0, $zero, res_error
    nop
    andi $k0, $k1, 0x1
    syscall
    bne $k0, $zero, res_error
    syscall
    li $k1, 0x12345678
    HIT_GOOD_TRAP		# stop temu    

    .org 0x380
exception:
    li $k0, 0x0
    nop
    nop
    eret

res_error: 
    li $s1, 0x11111111
    HIT_BAD_TRAP		# stop temu